package com.base.tree;

import java.util.HashMap;
import java.util.Map;

public abstract class TreeManager {
	
	// tree实例列表
	public static Map<String, Tree> trees = new HashMap<String, Tree>();
	
	/**
	 * 注册tree
	 * @param tree
	 * @return
	 */
	public static String register(Tree tree) {
		String id = TreeUtil.requestId();
		tree.setId(id);
		trees.put(id, tree);
		return id;
	}
	
	public static Tree getTree(String id) {
		return trees.get(id);
	}
}
